package com.projectzqjz.parttimework.utils;

import com.projectzqjz.parttimework.App;
import com.projectzqjz.parttimework.base.Constant;

/**
 * Created by Steven on 2019/1/24.
 */
public class UserUtils {
    //判断用户是否登录

    public static boolean checkLogin() {
        //发生变化  进行调试
        String accessToken = SPUtils.get(App.getContext(), Constant.CommonInfo.TOKEN, "") + "";
        String userId=SPUtils.get(App.getContext(),"userId", "") + "";
        return !"".equals(accessToken) && !"".equals(userId);

    }

    //清空用户信息  4003 和 4004的时候
    public static void clearUserInfo() {
//        String uniqueIdentifier=SPUtils.get(App.getContext(),"uniqueIdentifier","")+"";
//        String token = SPUtils.get(App.getContext(), Constant.CommonInfo.TOKEN, "") + "";
        SPUtils.clear(App.getContext());//清楚所有信息
//        SPUtils.put(App.getContext(),"uniqueIdentifier",uniqueIdentifier);
//        SPUtils.put(App.getContext(),"token",token);
//        SPUtils.remove(App.getContext(), Constant.CommonInfo.ACCESS_TOKEN);
//        SPUtils.remove(App.getContext(), Constant.CommonInfo.TOKEN);
    }
    public static void clearAllUserInfo() {
        String uniqueIdentifier=SPUtils.get(App.getContext(),"uniqueIdentifier","00:00:00:02")+"";
        SPUtils.clear(App.getContext());//清楚所有信息
        SPUtils.put(App.getContext(),"uniqueIdentifier",uniqueIdentifier);
//        SPUtils.remove(App.getContext(), Constant.CommonInfo.ACCESS_TOKEN);
//        SPUtils.remove(App.getContext(), Constant.CommonInfo.TOKEN);
    }
}
